<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="commontaglib"%>
<%
String path = request.getContextPath();

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
 
<html>
  <head>
    <link rel="stylesheet" href="<%=path%>/css/innerstyle.css" type="text/css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<%=path%>/css/cupertino/jquery-ui.custom.min.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<%=path%>/css/ui.jqgrid.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<%=path%>/css/ui.multiselect.css" />
    <script type="text/javascript" src="<%=path%>/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="<%=path%>/js/jquery-ui.custom.min.js"></script>  
    <script type="text/javascript" src="<%=path%>/js/i18n/grid.locale-cn.js"></script> 
    <script type="text/javascript" src="<%=path%>/js/jquery.jqGrid.min.js"></script>
    <script type="text/javascript" src="<%=path%>/js/i18n/jquery.ui.datepicker-zh-CN.js"></script>
    <style>
html, body {
	margin: 0;			 
	padding: 0;	 
    font-size: 85%;
}
</style>
    
  </head>
    <script type="text/javascript">  
  function loadTab(){ 
  var lx = '${bblx}'; 
  //alert(lx);
      $("#myTab").jqGrid({      
    url:'loadBdXmlInfo.action?bblx='+lx,   
    datatype: 'json',
    mtype: 'post',         
   	colNames:['操作','上传时间','文件名','文件大小'],
   	colModel:[
   	    {name:'modify',index:'sid',width:60,align:"center"},
   		{name:'gxsj',index:'gxsj', width:200},	
   		{name:'wjmc',index:'wjmc', width:400},		
   		{name:'shul',index:'shul', width:150, sortable:false}		
   	],
   
    jsonReader: {
           repeatitems : false, 
           id: 'sid'
         },    	
   	rowNum:10,
   	rowList:[10,20,30],     	
   	pager: '#pager13',
   	rownumbers: true,   	 
    viewrecords: true,
    multiselect: true, 
    sortorder: 'desc',
	caption: "文件列表",	
	gridComplete:function()
	{ //在此事件中循环为每一行添加修改和删除链接 	
		var ids=$("#myTab").jqGrid('getDataIDs'); 
		//alert(ids);
		for(var j=0; j<ids.length; j++)
		{		
		     id=ids[j];		    
			 verify="<a href='#' style='color:#f60' onclick='modify("+ id +")'>编辑</a>";
			$("#myTab").jqGrid('setRowData',id, { modify: verify }); 
			
		}
	}
  });
  $("#myTab").jqGrid('setGridHeight','300px');
  }

    $(function(){ 
    $("#xinz").button(); 
    $("#chax").button();
    $("#shangc").button();           
    $( "#datepicker" ).datepicker($.datepicker.regional[ "zh-CN" ]); 
    loadTab();    
 });

// 查询
function search(){   
  var formdata = $("#form1").serialize();  
  $("#myTab").jqGrid('setGridParam',{url:'/bbgl/loadBdXmlInfo.action?'+formdata+'&bblx='+lx,mtype:'post',page:1}).trigger("reloadGrid"); 
}

function modify(id) {
    var lx = '${bblx}';
    //alert(lx);   
    if(id.id!=undefined){
    window.location.href='<%=path %>/bbgl/findTempBbInfo.action?bblx='+lx+'&xtdh='+id.id;
    }else{
    var xtdh = id.item(1).cells.item(1).innerHTML;	
	window.location.href='<%=path %>/bbgl/findTempBbInfo.action?bblx='+lx+'&xtdh='+xtdh;
    }         
 }
 
 function download(){
 var lx = '${bblx}';
 if(lx==1){
 window.location.href="<%=request.getContextPath()%>/dayReport.zip";
 }else if(lx==2){
 window.location.href="<%=request.getContextPath()%>/monthReport.zip";
 }else{
 window.location.href="<%=request.getContextPath()%>/noteReport.zip";
 }
 
 }


</script>
<body>  
<div id="best1">
<form id="form1" method="post">
<table id="list_search" cellpadding="0" cellspacing="0" border="0"> 
        
		<tr>
            <td>
                                            上传日期:&nbsp;&nbsp;&nbsp;&nbsp;
            	<input id="datepicker" type="text" class="textbox" name="bean.AA" />
            	<input id="chax" type="button" value="查询" onclick="search();"/>
            </td>   
            
        </tr>
  </table>
  </form>
    <table id="list_search" cellpadding="0" cellspacing="0" border="0">
    <tr>
		    <td align="left">
		    <input id="shangc" type="button" name="" value="上传文件"  onclick= "window.location.href='<%=path %>/bbgl/bbdr.action?bblx=${bblx}',target='mainFrame'"/>&nbsp;&nbsp;&nbsp;
		    
		    <input id="xinz" type="button" value="模板下载" onclick="download();"/>
		    </td>
            
            
        </tr>
    </table>
    <table id="myTab" class="scroll" cellpadding="0" cellspacing="0"></table>  
   <div id="pager13" class="scroll"></div>  
   <div id="message" class="scroll"></div> 
</div> 

</body>
</html>
